From: Sebastian Keller Date: Sat, 30 Apr 2022 06:18:39 +0000 (+0200) Subject: Require both mouse and keyboard grabs for some grabs to be successful X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~480^2^2~3 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=23b4eb459ed66b2d268b4b28ba0fd0fc3c90177d;p=gnome-shell.git Require both mouse and keyboard grabs for some grabs to be successful Commit 7419674b changed some grabs from requiring both mouse and keyboard grabs to be considered successful to only requiring either of them. Due to this it was possible for example to open the overview or the screenshot UI with a client (such as Chrome when opening a menu) holding the mouse grab. This then made it impossible to interact with the UI using the mouse (or keyboard) and if attempted could result in an unresponsive UI. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5414 Part-of: --- diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js index c4028fc38..650bec48d 100644 --- a/js/ui/grabHelper.js +++ b/js/ui/grabHelper.js @@ -154,7 +154,7 @@ var GrabHelper = class GrabHelper { let firstGrab = this._modalCount == 0; if (firstGrab) { let grab = Main.pushModal(this._owner, this._modalParams); - if (grab.get_seat_state() === Clutter.GrabState.NONE) { + if (grab.get_seat_state() !== Clutter.GrabState.ALL) { Main.popModal(grab); return false; } diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js index 7dea38420..c7bf483e4 100644 --- a/js/ui/lookingGlass.js +++ b/js/ui/lookingGlass.js @@ -453,7 +453,7 @@ class ObjInspector extends St.ScrollView { return; const grab = Main.pushModal(this, { actionMode: Shell.ActionMode.LOOKING_GLASS }); - if (grab.get_seat_state() === Clutter.GrabState.NONE) { + if (grab.get_seat_state() !== Clutter.GrabState.ALL) { Main.popModal(grab); return; } @@ -1612,7 +1612,7 @@ class LookingGlass extends St.BoxLayout { return; let grab = Main.pushModal(this, { actionMode: Shell.ActionMode.LOOKING_GLASS }); - if (grab.get_seat_state() === Clutter.GrabState.NONE) { + if (grab.get_seat_state() !== Clutter.GrabState.ALL) { Main.popModal(grab); return; } diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index 04c0cf8ca..64800a376 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -237,7 +237,7 @@ var ModalDialog = GObject.registerClass({ if (timestamp) params['timestamp'] = timestamp; let grab = Main.pushModal(this, params); - if (grab.get_seat_state() === Clutter.GrabState.NONE) { + if (grab.get_seat_state() !== Clutter.GrabState.ALL) { Main.popModal(grab); return false; } diff --git a/js/ui/overview.js b/js/ui/overview.js index 4e86860ca..615c6b10a 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -456,14 +456,14 @@ var Overview = class { const grab = Main.pushModal(global.stage, { actionMode: Shell.ActionMode.OVERVIEW, }); - if (grab.get_seat_state() !== Clutter.GrabState.NONE) { - this._grab = grab; - this._modal = true; - } else { + if (grab.get_seat_state() !== Clutter.GrabState.ALL) { Main.popModal(grab); this.hide(); return false; } + + this._grab = grab; + this._modal = true; } } else { // eslint-disable-next-line no-lonely-if